package com.kedou.app;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

/**
 * Activity基类
 * 
 * @author zc
 * 
 */
public class BaseActivity extends Activity {
	public TextView mTvTitle;
	public ProgressDialog mProgressDialog;

	/**
	 * 设置Title Textview 内容
	 * 
	 * @param mTitleContent
	 *            String Id
	 */
	public void setTitle(int StringId) {
		mTvTitle = (TextView) this.findViewById(R.id.tv_title);
		mTvTitle.setText(getResources().getString(StringId));
	}

	/**
	 * 根据String Id返回String内容
	 * 
	 * @param StringId
	 *            String Id
	 * @return String Id对应内容
	 */
	public String getStringText(int StringId) {
		return getResources().getString(StringId);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initDialog();
	}

	/**
	 * 初始化对话框
	 */
	private void initDialog() {
		mProgressDialog = new ProgressDialog(this);
		mProgressDialog.setMessage(getResources().getString(R.string.loading));
		mProgressDialog.setIndeterminate(true);
		mProgressDialog.setCancelable(false);
		Window window = mProgressDialog.getWindow();
		WindowManager.LayoutParams lp = window.getAttributes();
		lp.alpha = 0.7f;// 透明度
		lp.dimAmount = 0.8f;// 黑暗度
		window.setAttributes(lp);
	}
}
